// pages/news-details/news-details.js
Page({
  data: {
    flag:0
  },

  onLoad: function (options) {
    wx.showLoading({
      title: '加载中...',
    })
    let news_id = options.news_id
    let access_token = wx.getStorageSync('access_token')
    wx.request({
      url: 'https://retire.wshoto.com/wx/newsdetail',
      data:{
        access_token:access_token,
        news_id:news_id
      },
      success:(res)=>{
        console.log(res)
        if(res.data.code >= 500){
          app.getLogin().then(function(){
            console.log('二次登录。。。')
          })
        } else if(res.data.code == 1){
          this.setData({
            title:res.data.info.title,
            date:res.data.info.created_at,
            content:res.data.info.content,
            flag:1
          })
        }
      },
      complete:(res)=>{
        wx.hideLoading()
      }
    })
  },

})